#!/bin/bash 
line(){
    temp=$1
    i=0
    while [ $i -ne `expr $temp + 1` ]
    do
        if [ $i -eq $temp ]||[ $i -eq 0 ]
        then 
            echo -n 1
        else
            echo -n $(expr $2 + $3)
            shift
        fi
        echo -n " "
        i=`expr $i + 1`
    done
 
 
}
if [ $# -ne 1 ]
then
    echo "请输入行数"
    read COUNT
else
    COUNT=$1
fi
echo "杨辉三角为"
i=0
while [ $i -ne  $COUNT ]
do
    temp=(`line $i ${temp[*]}`)
    echo ${temp[*]}
    i=`expr $i + 1`
done
